import React, { Key, useEffect, useState } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import { ColumnsType, TableProps } from '_antd@4.24.12@antd/es/table';
import ActivityTable from '@/pages/dashboard/workplace/components/ActivityTable';
import {
  Typography,
  PageHeader,
  Row,
  Tag,
  Table,
  Card,
  Tabs,
  Button,
  Modal,
  Form,
  Input,
  DatePicker,
  Select,
  Upload,
  Space,
  Descriptions,
  Col
} from 'antd';
import { CarryOutOutlined, PlusOutlined, UploadOutlined } from '@ant-design/icons';
import type { TabsProps } from 'antd';
const { Option } = Select;
const { TextArea } = Input;
const { Paragraph } = Typography;//说明文字的标签
import {
  getactivityList,
} from '@/services/workplace'
import {
  createParentActivity,
} from '@/services/activityInfo'
import { ProCard, ProColumns, ProTable } from '@ant-design/pro-components';
import { Dispatch, connect, useDispatch, useLocation } from 'umi';

function StudentInfoDetail(props: any) {
  const dispatch = useDispatch();
  const [stuBaseInfoTableListData, setStuBaseInfoTableListData] = useState();
  const [stuFamilyInfoTableListData, setStuFamilyInfoTableListData] = useState();
  const location = useLocation();
  const queryParams = new URLSearchParams(location.search);
  const stuCode = queryParams.get('stuCode');
  useEffect(() => {
    console.log(stuCode)
    dispatch({
      type: 'Model_Counsellor/getStuBaseInfoEffects',
      payload: {
        stuCode: stuCode,
        callback: (value: any) => {
          if(value.gender == 0) value.gender = "男"
          if(value.gender == 1) value.gender = "女"
          console.log(value);
          setStuBaseInfoTableListData(value);
        },
      },
    })
    dispatch({
      type: 'Model_Counsellor/getStuFamilyInfoEffects',
      payload: {
        stuCode: stuCode,
        callback: (value: any) => {
          console.log(value);
          if(value.isFinanciallyChallenged == 0) value.isFinanciallyChallenged = "否"
          if(value.isFinanciallyChallenged == 0) value.isFinanciallyChallenged = "是"
          if(value.isScholarshipApplied == 0) value.isScholarshipApplied = "否"
          if(value.isScholarshipApplied == 0) value.isScholarshipApplied = "是"
          value.familyMemberInfos?.forEach(item => {
            if (item.parentRelation == 0||item.parentRelation == 1) {value.father = item.parentName;value.fatherNumber = item.parentNumber}
            if (item.parentRelation == 2||item.parentRelation == 3) {value.mother = item.parentName;value.motherNumber = item.parentNumber}
          })
          setStuFamilyInfoTableListData(value);
        },
      },
    });
  }, [stuCode]);
  const content = (
    <>
      <Paragraph>
        河北工业大学电气工程学院举办系列活动具有重要意义。这些活动展示学院实力，拓宽学生知识面，培养实践能力，加强团队合作，并与专家、企业交流。活动提供实践锻炼，促进学术水平提高，培养学生综合素质，推动学院与业界合作。
      </Paragraph>
      <Paragraph>
        这些活动为电气工程学院提供了一个展示学院实力和学生才华的窗口。通过举办各类学术讲座、科技竞赛、创新创业活动等，学院能够吸引更多的人关注学院的教学质量和实践能力，提升学院的知名度和声誉。
      </Paragraph>
      <Paragraph>
        这些活动为学生提供了一个实践和锻炼的平台。通过参与活动，学生可以将在课堂上学到的知识应用到实际情境中，培养解决问题和创新思维的能力。
      </Paragraph>
    </>
  );
  //学生图像标签定义
  const Content = ({ children, extraContent, onNewActivityClick }: any) => (
    <Row>
      <div style={{ flex: 1 }}>{children}</div>

      <div style={{ marginRight: 10, marginTop: 3 }}><span style={{ fontSize: 18 }}></span></div>
      <div className="image">
        {extraContent}
      </div>
    </Row>
  );

  return (
    <PageContainer>
      <ProCard style={{ marginBottom: 24 }}>
        <PageHeader
          title={<b>学生信息</b>}
          subTitle="学生基本信息和学生家庭信息"
          tags={<Tag color="blue">运行中</Tag>}
          extra={<Button type="primary">
            下载学生信息
          </Button>}
        >
          <Content>
            {content}
          </Content>
        </PageHeader>
      </ProCard>
      <ProCard style={{ marginBottom: 24 }}>
        <Descriptions title="学生基本信息" bordered={true} column={3}>
          <Descriptions.Item label="姓名" >
            {stuBaseInfoTableListData?.stuName || ''}
          </Descriptions.Item>
          <Descriptions.Item label="学号" >
            {stuBaseInfoTableListData?.stuCode || ''}
          </Descriptions.Item>
          <Descriptions.Item label="性别" >
            {stuBaseInfoTableListData?.gender || ''}
          </Descriptions.Item>
          <Descriptions.Item label="民族" >
            {stuBaseInfoTableListData?.ethnicity || ''}
          </Descriptions.Item>
          <Descriptions.Item label="籍贯" >
            {stuBaseInfoTableListData?.hometown || ''}
          </Descriptions.Item>
          <Descriptions.Item label="出生年月"  >
            {stuBaseInfoTableListData?.birth || ''}
          </Descriptions.Item>
          <Descriptions.Item label="政治面貌"  >
            {stuBaseInfoTableListData?.politicalParty || ''}
          </Descriptions.Item>
          <Descriptions.Item label="身份证号"  >
            {stuBaseInfoTableListData?.idCard || ''}
          </Descriptions.Item>
          <Descriptions.Item label="手机号码"  >
            {stuBaseInfoTableListData?.phoneNumber || ''}
          </Descriptions.Item>
          <Descriptions.Item label="邮箱地址"  >
            {stuBaseInfoTableListData?.email || ''}
          </Descriptions.Item>
          <Descriptions.Item label="高考分数"  >
            {stuBaseInfoTableListData?.collegeEntranceScore || ''}
          </Descriptions.Item>
          <Descriptions.Item label="生源地" >
            {stuBaseInfoTableListData?.originPlace || ''}
          </Descriptions.Item>
          <Descriptions.Item label="专业" >
            {stuBaseInfoTableListData?.majorLabel || ''}
          </Descriptions.Item>
          <Descriptions.Item label="班级" >
            {stuBaseInfoTableListData?.classLabel || ''}
          </Descriptions.Item>
          <Descriptions.Item label="校区" >
            {stuBaseInfoTableListData?.dormitoryCampus || ''}
          </Descriptions.Item>
          <Descriptions.Item label="宿舍" >
            {stuBaseInfoTableListData?.dormitoryBuilding+'  '+stuBaseInfoTableListData?.dormitoryRoom || ''}
          </Descriptions.Item>
          <Descriptions.Item label="班导师" >
            {stuBaseInfoTableListData?.classAdvisor+'  '+stuBaseInfoTableListData?.advisorNumber || ''}
          </Descriptions.Item>
          <Descriptions.Item label="辅导员" >
            {stuBaseInfoTableListData?.instructorName+'  '+stuBaseInfoTableListData?.instructorNumber || ''}
          </Descriptions.Item>
          <Descriptions.Item label="爱好" >
            {stuBaseInfoTableListData?.hobbies || ''}
          </Descriptions.Item>
          <Descriptions.Item label="特长（获得奖项等）" span={4} >
            {stuBaseInfoTableListData?.advantages || ''}
          </Descriptions.Item>
        </Descriptions>

      </ProCard>
      <ProCard style={{ marginBottom: 24 }}>
        <Descriptions title="家庭基本信息" bordered={true} column={2}>
          <Descriptions.Item label="家庭是否困难">
            {stuFamilyInfoTableListData?.isFinanciallyChallenged || ''}
          </Descriptions.Item>
          <Descriptions.Item label="是否申请助学金">
            {stuFamilyInfoTableListData?.isScholarshipApplied || ''}
          </Descriptions.Item>
          <Descriptions.Item label="父亲姓名">
            {stuFamilyInfoTableListData?.father|| ''}
          </Descriptions.Item>
          <Descriptions.Item label="父亲电话号码">
          {stuFamilyInfoTableListData?.fatherNumber|| ''}
          </Descriptions.Item>
          <Descriptions.Item label="母亲姓名">
          {stuFamilyInfoTableListData?.mother|| ''}
          </Descriptions.Item>
          <Descriptions.Item label="母亲电话号码">
          {stuFamilyInfoTableListData?.motherNumber|| ''}
          </Descriptions.Item>
          <Descriptions.Item
            label="家庭住址" span={2}
          >
            {stuFamilyInfoTableListData?.homeAddress || ''}
          </Descriptions.Item>
        </Descriptions>
      </ProCard>
    </PageContainer>
  )
}

export default connect(({ Model_createclusterModel }: any) => ({
  Model_createclusterModel,
}))(StudentInfoDetail);
